export function searchColumns() {
  return [
    {
      prop: 'unique_id',
      placeholder: '请输入用户ID',
    },
    {
      filterable: true,
      type: 'select',
      prop: 'channel',
      placeholder: '请选择渠道',
      dicData: this.channelList?.list,
      props: {
        value: 'no',
        label: 'no',
      },
    },
    {
      prop: 'country_id',
      type: 'select',
      dicData: this.countryList,
      filterable: true,
      props: {
        value: 'id',
        label: 'full_name',
      },
      typeformat(row) {
        return `(${row?.short_name})${row?.full_name}`
      },
      placeholder: '请选择国家',
    },
    {
      prop: 'status',
      type: 'select',
      dicData: [
        { label: '正常', value: 1 },
        { label: '禁用', value: 2 },
      ],
      filterable: true,
      placeholder: '请选择账号状态',
    },
    {
      prop: 'dateRange',
      type: 'daterange',
    },
  ]
}

export function tableColumns() {
  return [
    {
      width: 80,
      label: '序号',
      prop: 'id',
    },
    {
      label: '用户ID',
      prop: 'unique_id',
    },

    {
      width: 200,
      align: 'left',
      label: '账号(邮箱)',
      prop: 'email',
    },
    // {
    //   align: 'right',
    //   label: '总充值',
    //   prop: 'balance',
    //   formatter: row => row?.balance / 10000,
    // },
    {
      label: '余额($)',
      prop: 'balance',
      formatter: row => ` ${row?.balance / 10000}
        `,
    },

    {
      width: 120,
      align: 'right',
      label: '账号消费总金额($)',
      prop: 'sum_consume',
      formatter: row => row?.sum_consume / 10000,
    },
    {
      label: '账号状态',
      prop: 'status',
      html: true,
      formatter: row =>
        `<span class="${row?.status === 1 ? 'text-success' : 'text-danger'}">${
          row?.status === 1 ? '正常' : '禁用'
        }</span>`,
    },
    {
      width: 140,
      label: '注册时间',
      prop: 'register_time',
      formatter: row => this.$formatTime(row?.register_time),
    },
    {
      label: '渠道',
      prop: 'channel',
    },
    {
      label: '国家',
      prop: 'country_name',
    },
    {
      width: 150,
      label: 'IP',
      prop: 'ip',
    },

    {
      width: 150,
      label: '注册时版本号',
      prop: 'register_app_code',
    },
    {
      width: 150,
      label: '当前版本号',
      prop: 'cur_app_code',
    },
    {
      width: 140,
      label: '最近一次登录时间',
      prop: 'last_login',
      formatter: row => (row?.last_login == 0 ? '--' : this.$formatTime(row?.last_login)),
    },

    {
      label: '账号日志',
      prop: 'accountLog',
    },
  ]
}
